/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.persistencia.domain;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author kenny
 */
@Entity
@Table(name = "salonxrecurso")
@NamedQueries({
    @NamedQuery(name = "Salonxrecurso.findAll", query = "SELECT s FROM Salonxrecurso s"),
    @NamedQuery(name = "Salonxrecurso.findByNSlnId", query = "SELECT s FROM Salonxrecurso s WHERE s.salonxrecursoPK.nSlnId = :nSlnId"),
    @NamedQuery(name = "Salonxrecurso.findByNRcrId", query = "SELECT s FROM Salonxrecurso s WHERE s.salonxrecursoPK.nRcrId = :nRcrId"),
    @NamedQuery(name = "Salonxrecurso.findByNCantidad", query = "SELECT s FROM Salonxrecurso s WHERE s.nCantidad = :nCantidad"),
    @NamedQuery(name = "Salonxrecurso.findByVEstado", query = "SELECT s FROM Salonxrecurso s WHERE s.vEstado = :vEstado")})
public class Salonxrecurso implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SalonxrecursoPK salonxrecursoPK;
    @Basic(optional = false)
    @NotNull
    @Column(name = "nCantidad")
    private int nCantidad;
    @Size(max = 1)
    @Column(name = "vEstado")
    private String vEstado;
    @JoinColumn(name = "nSlnId", referencedColumnName = "nSlnId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Salon salon;
    @JoinColumn(name = "nRcrId", referencedColumnName = "nRcrId", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Recurso recurso;

    public Salonxrecurso() {
    }

    public Salonxrecurso(SalonxrecursoPK salonxrecursoPK) {
        this.salonxrecursoPK = salonxrecursoPK;
    }

    public Salonxrecurso(SalonxrecursoPK salonxrecursoPK, int nCantidad) {
        this.salonxrecursoPK = salonxrecursoPK;
        this.nCantidad = nCantidad;
    }

    public Salonxrecurso(int nSlnId, int nRcrId) {
        this.salonxrecursoPK = new SalonxrecursoPK(nSlnId, nRcrId);
    }

    public SalonxrecursoPK getSalonxrecursoPK() {
        return salonxrecursoPK;
    }

    public void setSalonxrecursoPK(SalonxrecursoPK salonxrecursoPK) {
        this.salonxrecursoPK = salonxrecursoPK;
    }

    public int getNCantidad() {
        return nCantidad;
    }

    public void setNCantidad(int nCantidad) {
        this.nCantidad = nCantidad;
    }

    public String getVEstado() {
        return vEstado;
    }

    public void setVEstado(String vEstado) {
        this.vEstado = vEstado;
    }

    public Salon getSalon() {
        return salon;
    }

    public void setSalon(Salon salon) {
        this.salon = salon;
    }

    public Recurso getRecurso() {
        return recurso;
    }

    public void setRecurso(Recurso recurso) {
        this.recurso = recurso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (salonxrecursoPK != null ? salonxrecursoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Salonxrecurso)) {
            return false;
        }
        Salonxrecurso other = (Salonxrecurso) object;
        if ((this.salonxrecursoPK == null && other.salonxrecursoPK != null) || (this.salonxrecursoPK != null && !this.salonxrecursoPK.equals(other.salonxrecursoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.persistencia.domain.Salonxrecurso[ salonxrecursoPK=" + salonxrecursoPK + " ]";
    }
    
}
